package cn.wit.testalgorithms;
/**
 * 27.移除元素
 * @author 16604
 *
 */
public class DemoDeleteNumbers {
	public static void main(String[] args) {
		int[] nums = {3,2,2,3};
		int val = 3;
		
		System.out.println(removeElement(nums,val));
		
	}
	 public static int removeElement(int[] nums, int val) {
		 
		 int numbers = 0;
		 
		 for(int i =0;i<nums.length;i++) {
			 if(nums[i]!=3) {
				 nums[numbers]=nums[i];
				 numbers++;
			 }
		 }
		 
		 return numbers;
	 }

}
